import Vue from 'vue'
import Router from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      redirect: { name: 'welcome' },
      children: [
        {
          path: 'welcome',
          name: 'welcome',
          component: () => import(/* webpackChunkName: "welcome" */ '../views/Welcome.vue')
        },
        {
          path: 'orders',
          name: 'orders',
          component: () => import(/* webpackChunkName: "orders" */ '../views/order/Orders.vue')
        }
      ]

    },
    {
      path: '/login',
      name: 'login',
      component: () => import(/* webpackChunkName: "login" */ '../views/Login.vue')
    },
    // 用户管理模块
    {
      path: '/',
      name: '用户管理',
      component: Home,
      children: [
        {
          path: 'users',
          name: 'users',
          component: () => import(/* webpackChunkName: "user" */ '../views/user/User.vue')
        }
      ]
    },
    // 数据统计模块
    {
      path: '/',
      name: '数据统计',
      component: Home,
      children: [
        {
          path: 'reports',
          name: 'reports',
          component: () => import(/* webpackChunkName: "statistics" */ '../views/report/Report.vue')
        }
      ]
    },
    {
      path: '/',
      name: 'home',
      component: Home,
      children: [
        {
          path: '/goods',
          name: 'goods',
          component: () => import(/* webpackChunkName: "goods" */ './../views/goods/goodspage.vue')
        },
        {
          path: '/addGoods',
          name: 'addGoods',
          component: () => import(/* webpackChunkName: "goods" */ './../views/goods/addgoods.vue')
        }
      ]
    },

    // 添加分类参数路由
    {
      path: '/',
      name: 'home',
      component: Home,
      children: [
        {
          path: 'params',
          name: 'params',
          component: () => import(/* webpackChunkName: "params" */ '@/views/trades/Params.vue')
        }
      ]
    },
    // 添加商品分类路由
    {
      path: '/',
      name: 'home',
      component: Home,
      children: [
        {
          path: 'categories',
          name: 'categories',
          component: () => import(/* webpackChunkName: "categories" */ '@/views/trades/Categories.vue')
        }
      ]
    },
    {
      path: '/',
      name: 'home',
      component: Home,
      children: [
        {
          path: 'roles',
          name: 'roles',
          component: () => import(/* webpackChunkName: "roles" */ '../views/auth/roles.vue')
        },
        {
          path: 'rights',
          name: 'rights',
          component: () => import(/* webpackChunkName: "rights" */ '../views/auth/Rights.vue')
        }

      ]
    }

  ]
})
